﻿@{
    ViewBag.Title = "Click2";
}
<ul data-bind="foreach: places">
    <li>
        <span data-bind="text: $data.Name"></span>
        <a href="#" data-bind="click: $parent.removePlace">移除</a>
    </li>
</ul>

<script type="text/javascript">
    function MyViewModel() {
        var self = this;
        self.places = ko.observableArray([{ ID: 1, Name: "伦敦" }, { ID: 2, Name: "香港" }, { ID: 3, Name: "巴黎" }]);

        // The current item will be passed as the first parameter, so we know which place to remove 
        self.removePlace = function (place) {
            console.log(place);
            self.places.remove(place);
        }
    }
    ko.applyBindings(new MyViewModel());
     

    var numbers = [ 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 ,5];
    var oddNumbers =  _(numbers).find(function (a) { return a % 2 == 1 });
    console.log(oddNumbers);

</script>
